<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  const d1 = new Promise((resolve, reject) => {
    try {
      console.log('正在获取A元素')
      setTimeout(() => {
        console.log('A元素已获取')
        resolve('okok')
      }, 2000)
    } catch (e) {
      reject(e.message)
    }
  })
</script>

</html>